﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using XProject.DataVisit.Factory;

namespace XProject.DataVisit.Model.Advertisement
{
    public class BindAdvertisement:IProjectModel
    {
        public virtual Guid PID { get; set; }
        /// <summary>
        /// 起始时间
        /// </summary>
        public virtual DateTime FTime { get; set; }

        public virtual string F_Time {
            get {
                return FTime.ToString("yyyy-MM-dd hh:mm:ss");
            }
        }
        /// <summary>
        /// 结束时间
        /// </summary>
        public virtual DateTime ETime { get; set; }
        public virtual string E_Time
        {
            get
            {
                return ETime.ToString("yyyy-MM-dd hh:mm:ss");
            }
        }
        /// <summary>
        /// 广告ID
        /// </summary>
        public virtual Guid AdvertisementID { get; set; }
        /// <summary>
        /// 设备ID
        /// </summary>
        public virtual Guid EquipmentID { get; set; }
        /// <summary>
        /// 更新时间
        /// </summary>
        public virtual DateTime Lastupdate { get; set; }
        public virtual string NTime {
            get {
                return Lastupdate.ToString("yyyy-MM-dd");
            }
        }
        /// <summary>
        /// 发布人
        /// </summary>
        public virtual string Creater { get; set; }



        #region 拓展属性
        public Advertisement CurrentAd
        {
            get {
                if (AdvertisementID!=Guid.Empty)
                    return DaoFactory.AdvertisementDao.GetById(AdvertisementID);
                return null;
            }
        }
        #endregion
    }
}
